args=(commandArgs(TRUE)); for(i in 1:length(args)) { eval(parse(text=args[[i]])) }
wd = '/home/jc165798/Climate/CIAS/Australia/1km/bioclim_asc/'; setwd(wd)
od = '/home/jc148322/clim.data/Australia_1km/'; dir.create(od) #define and create the output directory
tfiles = list.files() #get a list of the files

zip(paste(od,'RCP_',gcm,'.zip',sep=''),tfiles[intersect(grep(gcm,tfiles),grep('RCP',tfiles))],flags = "-r0X")
zip(paste(od,'SRES_',gcm,'.zip',sep=''),tfiles[intersect(grep(gcm,tfiles),grep('SRES',tfiles))],flags = "-r0X")